<template>
<div class="thumbnail" v-if='data' >

    <div class="main-img">
        <div class="img-box">
            <img :src="imgs[current]" alt="">
        </div>
    </div>

    <div class="sub-imgs">
            <i-row :gutter='10'>
                <i-col :span='8'  v-for='(item, index) of imgs' :key='index' >
                    <div class="sub-img img-box" @mouseover='() =>{select(index)}' @click='() =>{select(index)}' >
                        <img :src="item" alt="">
                    </div>
                </i-col>
            </i-row>
            
        </div>
    </div>

</div>
</template>

<script lang='ts'>
import {Component, Vue, Prop} from 'vue-property-decorator';


@Component
export default class thumbnail extends Vue{

    @Prop()
    data?:Array<string>

    current: number = 0;

    // 保证组件空值时显示
    get imgs(){
        return this.data || ['', '', ''];
    }
    
    select(num:number){
        this.current = num
    }
    
}


</script>

<style scoped lang='less'>
.thumbnail{
    
}

.main-img{
    height: 400*@rem;
    border: 1*@rem solid @mainColor;
}

.sub-imgs{
    margin-top: 20*@rem;
    
}

.sub-img{
    height: 120*@rem;
    border: 1*@rem solid @mainColor;
}

/*  760px  */

@media (max-width: 768px){

    .thumbnail{
        margin-top: 30*@rem;
    }    

    .main-img{
        border: none;
    }

    .sub-imgs{
        padding: 0 10*@rem;
    }
    
    .sub-img{
        border: none;
    }
}

</style>